package com.csgc.camera.storage

import com.csgc.camera.storage.base.BasePreferences


class MaskPreference private constructor(preferenceID:String): BasePreferences(preferenceID ) {

    companion object{

        private const val KEY_MASK_TYPE = "mask_type"
        private const val KEY_MASK_ID = "mask_id"

        private const val KEY_IDENTITY_TYPE = "identity_type"
        private const val KEY_IDENTITY_ID = "identity_id"

        private const val KEY_LOCATION_STYLE = "location_style"

        val instance by lazy(LazyThreadSafetyMode.NONE){
            MaskPreference("mask")
        }
    }


    fun setMaskType(type:Int){
        setInt(KEY_MASK_TYPE,type)
    }

    fun setIdentityType(type:Int){
        setInt(KEY_IDENTITY_TYPE,type)
    }

    fun setIdentityId(id:Int){
        setInt(KEY_IDENTITY_ID,id)
    }

    fun getIdentityId():Int{
        return getInt(KEY_IDENTITY_ID)?:-1
    }

    fun getIdentityType():Int{
        return getInt(KEY_IDENTITY_TYPE)?:-1
    }
    fun getMaskType():Int{
       return getInt(KEY_MASK_TYPE)?:-1
    }

    fun setMaskId(id:Int){
        setInt(KEY_MASK_ID,id)
    }
    fun getMaskId():Int{
        return getInt(KEY_MASK_ID)?:-1
    }

    /**
     * 定位样式
     */
    fun getLocationStyle():Int{
        return getInt(KEY_LOCATION_STYLE,1)?:1
    }
    fun setLocationStyle(style:Int){
        setInt(KEY_LOCATION_STYLE,style)
    }
}